﻿using CommonLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace CommonSite.Common
{
    public class APIResult
    {
        public static string Success = "{\"code\":0, \"msg\":\"操作成功\"}";
        public static string Failed = "{\"code\":199, \"msg\":\"操作失败\"}";
        public static string ArgumentFailed = "{\"code\":100, \"msg\":\"参数错误\"}";

        public int code;
        public string msg;

        public APIResult() { }
        public APIResult(int code, string msg)
        {
            this.code = code;
            this.msg = msg;
        }

        public static string Create(string msg, int code = 199)
        {
            return JSON.ToString(new APIResult(code, msg));
        }
    }
}